*Table 1: Main models table 1*
*use "Strategic manipulation repdata.dta" for results in tables* 
*Match on previous fraud, democracy level, violence in earlier elections, development assistance, and whether elections were previously observed*
cem   prevfraud polity2lag(#3)   prevelecviolence netoda_ln(#3) previous_obs , treatment(monitored)
*Main model 1 pre-election violence model*
nbreg     previolence  monitored pressfreedom winmarginlag   prevfraud   netoda_ln     ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Main model 2 with press freedom interaction*
nbreg     previolence  monitored pressfreedom press_monitored  winmarginlag   prevfraud  netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)

*Main model 3 election-day violence*
nbreg     elecviolence  monitored pressfreedom winmarginlag   prevfraud   netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Main model 4 with press freedom interaction
nbreg     elecviolence  monitored pressfreedom press_monitored winmarginlag   prevfraud  netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)


* Table 2: Marginal Effects for model 1*
nbreg     previolence  i.monitored winmarginlag   i.prevfraud i.pressfreedom  netoda_ln     ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
margins, atmeans at(monitored=0)
margins, atmeans at(monitored=1)
margins, atmeans at(prevfraud=0)
margins, atmeans at(prevfraud=1)
margins, atmeans at(pressfreedom=0)
margins, atmeans at(pressfreedom=2)
margins, atmeans at(ln_pop=7.8)
margins, atmeans at(ln_pop=10.2)
margins, atmeans at(ethfrac=0.36)
margins, atmeans at(ethfrac=0.84)

*Table 3: Press freedom and monitoring interaction, predicted probabilities for values of interest, interactions* 
*Press freedom and monitoring* 
nbreg     previolence  monitored winmarginlag   prevfraud  pressfreedom press_monitored   netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
margins, at((means) pressfreedom=0 monitored=0 press_monitored=0)
margins, at((means) pressfreedom=0 monitored=1 press_monitored=0)
margins, at((means) pressfreedom=1 monitored=0 press_monitored=0)
margins, at((means) pressfreedom=1 monitored=1 press_monitored=1)
margins, at((means) pressfreedom=2 monitored=0 press_monitored=0)
margins, at((means) pressfreedom=2 monitored=1 press_monitored=2)

*Robustness Tests* 
*Table A1: Robustness Tests preelection violence*
*Only violence committed by government actors*
nbreg     pregov  monitored pressfreedom winmarginlag   prevfraud  netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Only violence by nonstate actors*
nbreg     prenonstate  monitored pressfreedom winmarginlag   prevfraud  netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Only large mission*
nbreg      previolence largemonitored pressfreedom winmarginlag   prevfraud  netoda_ln    ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight] ,  cluster(ccode)
*Comparison with low-quality monitors, excluding mixed missions* 
nbreg      previolence lowqual_nomix pressfreedom winmarginlag   prevfraud  netoda_ln    ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight] ,  cluster(ccode)
*Non election-related violence* 
nbreg      previolence_nonelection pressfreedom monitored winmarginlag   prevfraud   netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Pre-election monitoring*
nbreg      previolence premonitored pressfreedom winmarginlag   prevfraud  netoda_ln    ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Pre-election monitoring, government violence*
nbreg      pregov premonitored pressfreedom winmarginlag   prevfraud  netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Pre-election monitoring, nonstate violence*
nbreg      prenonstate premonitored pressfreedom winmarginlag   prevfraud   netoda_ln   ln_gdpcaplag ln_pop  ethfrac [iweight=cem_weight],  cluster(ccode)
*Main model without matching*
nbreg     previolence  monitored pressfreedom winmarginlag   prevfraud   netoda_ln     ln_gdpcaplag ln_pop  ethfrac ,  cluster(ccode)

*Differences of Means Figure*
*use "Data for Figure 1 repdata.dta" for this figure* 
twoway bar  diffmeans eventday if eventday<15 , yscale(r(-0.05 0.15))  yline(0.02 -0.02, lpattern(-) lwidth(vthin) lcolor(gs8))  subtitle("Figure 1: Differences in Means of Violent Events" "Comparing High-Quality Observers to No Observers") ytitle("Differences in Means") bcolor(gs13) saving(hqual, replace)

